<?php
include_once '../dao/UserDao.class.php';
class UserService {
	
	private $userDao ;
	
	public function UserService(){
		$this->userDao = new UserDao();
	}
	
	/*
	 * 用户注册
	 */
	public function regist($username,$password,$email,$code) {
		return $this->userDao->regist($username, $password, $email,$code);
	}
	/*
	 * 查询用户名是否存在
	 */
	public function nameIsExist($username){
		return $this->userDao->nameIsExist($username);
	}
	
	/*
	 * 用户登陆
	 */
	public function login($username,$password){
		return $this->userDao->login($username, $password);
	}
	
	/**
	 * 验证邮箱并将验证状态(v_isVa)改为1
	 */
	
	public function validationEmail($code) {
		return	$this->userDao->validationEmail($code);
	}
	
	
	/**
	 * 登录时判断邮箱是否验证
	 * @param  $u_username 用户名
	 */
	public function emailIsValidation($u_username) {
		return $this->userDao->emailIsValidation($u_username);
	}
	
	/**
	 * 根据用户名查找用户
	 * @param unknown $username : 用户名
	 */
	public function selectUserIDByUsername($username) {
		return $this->userDao->selectUserIDByUsername($username);
	}
	
}